using System;
using System.Data;
using System.Collections.Generic;
using System.Data.SqlClient;
using Core;
using log4net;

namespace DataAccess
{
    public class tbResourceType_Proxy
    {
        ILog log = LogManager.GetLogger(typeof(DataAccess.tbResourceType).Name);
        Popular cur = new tbResourceType();
        public bool Insert_tbResourceType_Proxy(Popular cn)
        {
            bool kq = true;
            try
            {
                kq = cur.Insert(cn);
            }
            catch (Exception)
            {
                kq = false;
            }
            if (kq)
                log.Info(" form tbResourceType insert success");
            else
                log.Info("form tbResourceType insert fail");
            return kq;
        }
        public bool Update_tbResourceType_Proxy(Popular cn)
        {
            bool kq = true;
            try
            {
                kq = cur.Update(cn);
            }
            catch (Exception) { kq = false; }
            if (kq)
                log.Info(" form tbResourceType update success");
            else
                log.Info("form tbResourceType update fail");
            return kq;
        }
        public bool Delete_tbResourceType_Proxy(object b)
        {
            bool kq = true;
            try
            {
                kq = cur.Delete(b);
            }
            catch (Exception) { kq = false; }
            if (kq)
                log.Info(" form tbResourceType delete success");
            else
                log.Info("form tbResourceType delete fail");
            return kq;
        }
        public IDataReader GetById_tbResourceType_Proxy(object b)
        {
            log.Info(" form tbResourceType Search by Id");
            try { return cur.Select_ID(b); }
            catch (Exception) { throw; }
        }
        public IDataReader GetByName_tbResourceType_Proxy(object b)
        {
            log.Info(" form tbResourceType Search by Name");
            return cur.Select_Name(b);
        }
        public IDataReader SelectNo_tbResourceType_Proxy(object b)
        {
            log.Info(" form tbResourceType Search ");
            if (ConvertType.ToInt(b) != 0)
                return cur.Select_ID(b);
            return cur.Select_Name(b);
        }
        public IDataReader SelectAll_tbResourceType_Proxy()
        {
            log.Info(" form tbResourceType Load data");
            try { return cur.SelectAll(); }
            catch (Exception) { throw; }
        }
        public List<tbResourceType> SelectAlltbResourceType_Proxy()
        {
            tbResourceType kh = new tbResourceType();
            return kh.SelectAllToList();
        }
    }
}